<template>
			<view class="goodsBox flex" v-if="goodsList.length>0">
				<view class="goodsItem" v-for="(item,index) in goodsList" :key="index" @click="goSkip('/pages_mall/pages/mall/goods_details/goods_details?id=' + item.id)">
						<view class="goods-cover">
							<image :src="item.main_imgurl">
							</image>
						</view>
						<view class="goods-dateils">
							<view class="columnTop">
								<view class="title text-ellipsis">{{item.product_title}}</view>
							</view>
							<view class="bottomBox">
								<view class="pricr flex">
									<text style="font-size: 24rpx;">￥</text>
									<text>{{item.price}}</text>
									<text style="color: #717171; font-size: 22rpx !important;text-indent: 10rpx;">活动价</text>
								</view>
								
							</view>
						</view>
				</view>
			</view>
			<view class="notList" v-else>
				<image :src="`${baseImg}/static/constr/notList.png`" mode=""></image>
				空空如也
			</view>
</template>

<script>
	import service_product from '@/service/product.js'
	export default {
		props: ['stewardId','goodsList'],
		data() {
			return {
				baseImg: this.$static,
				steward_id:this.stewardId,
			}
		},
		
		created() {
			//let steward_id=this.stewardId
			//this.getProduct(steward_id);
		},
		methods: {
			getProduct(steward_id) {
				let params = {
					page: this.page,
					pagesize: this.pagesize,
					steward_id:steward_id,
				}
				this.statusLoading = 'loading'
				service_product.stewardProduct(params).then(res => {
					if (res.code == 1) {
						let data = res.data.products;
						let pages=this.page*this.pagesize
						if (pages>=res.data.total) {
							this.statusLoading = 'nomore'
						} else {
							this.statusLoading = 'loading'
						}
						this.goodsList = this.goodsList.concat(data)
					}
				})
			},
			goSkip(url){
				uni.navigateTo({
					url: url
				});
			},
		},
		onReachBottom() {
			console.log('123')
			this.page++;
			if (this.statusLoading == 'loading') {
				this.getProduct();
			}
		}
	}
</script>

<style lang="scss" scoped>
			.goodsBox {
				width: 94%;
				margin: 60rpx auto;
				position: relative;
                flex-wrap: wrap;
				padding-bottom: 20rpx;
				justify-content: space-between;
				.goodsItem {
					width: 48%;
					height: auto;
					margin-bottom: 60rpx;
               
					.goods-cover {
						width:90%;
						image {
							width: 340rpx;
							height:340rpx;
							border-radius: 20rpx;
						}
					}
					.goods-dateils {
						width:72%;
						margin-left:10rpx;
					   .columnTop{
						   width: 100%;
						   justify-content: space-between;
						   position: relative;
						   padding-top: 10rpx;
						  .title {
						  	width:450rpx;
						  	height: auto;
							margin-bottom: 10rpx;
						  }
						   .shareIcon{
							   width: 80rpx;
							   height:80rpx;
							   image{
								   width: 100%;
								   height: 100%;
								   margin-top: -8px;
							   }
						   }
					   }
						.tag {
							width: 200rpx;
							margin: 28rpx 0 0 0;
							height: auto;
							padding-bottom: 10rpx;
						}
					 .bottomBox{
						 .pricr {
						 	width: 350rpx;
						 	height: auto;
							color:#E86F12;
							font-size: 36rpx;
							align-items: center;
						 }
						 .sidebarRight {
							 color: #A6A6A6;
						 	padding-right: 20rpx;
						 }
					 }
						
					}
				}
				.loadmore{
					margin: auto;
					text-align: center;
				}
			}

		// 没有数据
		.notList {
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			bottom: 0;
			margin: auto;
			height: 400rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			width: 426rpx;

			image {
				width: 426rpx;
				height: 356rpx;
				margin-bottom: 40rpx;
			}

			font:500 40rpx/56rpx PingFang SC;
			color: #333;
		}
		.text-ellipsis{
			overflow: hidden;
			text-overflow:ellipsis;
			white-space: nowrap;
		}
		.flex{
			display: flex;
		}
</style>
